home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-10 | 7.5 KB | 189 lines | [TEXT/MPS ] |
- (*
- File: CursorDevices.mod
-
- Contains: Cursor Devices (mouse/trackball/etc) Interfaces.
-
- Version: Technology: System 7.5
- Package: Universal Interfaces 2.0 in “MPW Latest” on ETO #17
-
- Copyright: © 1984-1995 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- stack. Include the file and version information (from above)
- in the problem description and send to:
- Internet: apple.bugs.applelink.apple.com
- AppleLink: APPLE.BUGS
-
- *)
-
- (*$TAGS-*)
- (*$CALLING PASCAL*)
- MODULE CursorDevices;
-
- IMPORT SYSTEM, Types;
-
- (* $PUSH*)
- (* $ALIGN MAC68K*)
- (* $LibExport+*)
- (*
- * * * W A R N I N G * * *
-
- On currently shipping PowerMacs, the CursorDevices manager is implemented
- in 68K code and emulated. Unfortunately, the MixedMode glue in InterfaceLib
- is incorrect. It and the 1.0 version of this file had incorrect parameter
- lists for most functions.
-
- As a first step to avoid runtime errors, the functions in this file were
- renamed (e.g. from"CrsrDevButtons" to "CursorDeviceButtons"). This will result
- in a link time error if a PowerPC application tries to call the functions.
- When InterfaceLib is fixed, the new names will be exported and PowerPC
- code will then be able to call them.
-
- *)
-
- TYPE
- ButtonOpcode* = INTEGER;
-
- (* ButtonOpcodes *)
-
- CONST
- kButtonNoOp* = 0; (* No action for this button *)
- kButtonSingleClick* = 1; (* Normal mouse button *)
- kButtonDoubleClick* = 2; (* Click-release-click when pressed *)
- kButtonClickLock* = 3; (* Click on press, release on next press *)
- kButtonCustom* = 6; (* Custom behavior, data* = CursorDeviceCustomButtonUPP *)
-
- (* Device Classes *)
- kDeviceClassAbsolute* = 0; (* a flat-response device *)
- kDeviceClassMouse* = 1; (* mechanical or optical mouse *)
- kDeviceClassTrackball* = 2; (* trackball *)
- kDeviceClass3D* = 6; (* a 3D pointing device *)
-
- (* Structures used in Quickdraw.Cursor Device Manager calls *)
-
- TYPE
- CursorDataPtr* = POINTER TO CursorData;
- CursorData* = RECORD
- nextCursorData*: CursorDataPtr (*ΔΔ POINTER TO CursorData*); (* next in global list *)
- displayInfo*: Types.Ptr; (* unused (reserved for future) *)
- whereX*: Types.Fixed; (* horizontal position *)
- whereY*: Types.Fixed; (* vertical position *)
- where*: Types.Point; (* the pixel position *)
- isAbs*: BOOLEAN; (* has been stuffed with absolute coords *)
- buttonCount*: Types.SInt8; (* UInt8 *) (* number of buttons currently pressed *)
- screenRes*: INTEGER; (* pixels per inch on the current display *)
- privateFields*: ARRAY 22 (*ΔΔ[0..21]ΔΔ*) OF INTEGER; (* fields use internally by CDM *)
- END;
-
- CursorDevicePtr* = POINTER TO CursorDevice;
-
- CursorDevice* = RECORD
- nextCursorDevice*: CursorDevicePtr (*ΔΔ POINTER TO CursorDevice*); (* pointer to next record in linked list *)
- whichCursor*: CursorDataPtr (*ΔΔ POINTER TO CursorData*); (* pointer to data for target cursor *)
- refCon*: LONGINT; (* application-defined *)
- unused*: LONGINT; (* reserved for future *)
- devID*: Types.OSType; (* device identifier (from ADB reg 1) *)
- resolution*: Types.Fixed; (* units/inch (orig. from ADB reg 1) *)
- devClass*: Types.SInt8; (* UInt8 *) (* device class (from ADB reg 1) *)
- cntButtons*: Types.SInt8; (* UInt8 *) (* number of buttons (from ADB reg 1) *)
- filler1*: Types.SInt8; (* UInt8 *) (* reserved for future *)
- buttons*: Types.SInt8; (* UInt8 *) (* state of all buttons *)
- buttonOp*: ARRAY 8 (*ΔΔ[0..7]ΔΔ*) OF Types.SInt8; (* UInt8 *) (* action performed per button *)
- buttonTicks*: ARRAY 8 (*ΔΔ[0..7]ΔΔ*) OF LONGINT; (* ticks when button last went up (for debounce) *)
- buttonData*: ARRAY 8 (*ΔΔ[0..7]ΔΔ*) OF LONGINT; (* data for the button operation *)
- doubleClickTime*: LONGINT; (* device-specific double click speed *)
- acceleration*: Types.Fixed; (* current acceleration *)
- privateFields*: ARRAY 15 (*ΔΔ[0..14]ΔΔ*) OF INTEGER; (* fields used internally to CDM *)
- END;
-
-
- (* for use with CursorDeviceButtonOp when opcode* = kButtonCustom *)
- (*
- CursorDeviceCustomButtonProcPtr uses register based parameters on the 68k and cannot
- be written in or called from a high-level language without the help of
- mixed mode or assembly glue.
-
- In*:
- => ourDevice A2.L
- => button D3.W
- *)
- CursorDeviceCustomButtonProcPtr* = Types.Register68kProcPtr; (* register PROCEDURE CursorDeviceCustomButton*(ourDevice: CursorDevicePtr; button*: INTEGER); *)
- CursorDeviceCustomButtonUPP* = Types.UniversalProcPtr;
-
- CONST
- uppCursorDeviceCustomButtonProcInfo* = $000ED802; (* Register PROCEDURE (4 bytes in A2, 2 bytes in D3); *)
-
- PROCEDURE NewCursorDeviceCustomButtonProc*(userRoutine: CursorDeviceCustomButtonProcPtr): CursorDeviceCustomButtonUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE CallCursorDeviceCustomButtonProc*(ourDevice: CursorDevicePtr; button: INTEGER; userRoutine: CursorDeviceCustomButtonUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL ; (*••*)
- (*To be implemented: Glue to move parameters into registers.*)
- (*$END*)
-
- PROCEDURE CursorDeviceMove*(ourDevice: CursorDevicePtr; deltaX: LONGINT; deltaY: LONGINT): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7000, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceMoveTo*(ourDevice: CursorDevicePtr; absX: LONGINT; absY: LONGINT): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7001, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceFlush*(ourDevice: CursorDevicePtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7002, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceButtons*(ourDevice: CursorDevicePtr; buttons: INTEGER): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7003, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceButtonDown*(ourDevice: CursorDevicePtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7004, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceButtonUp*(ourDevice: CursorDevicePtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7005, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceButtonOp*(ourDevice: CursorDevicePtr; buttonNumber: INTEGER; opcode: ButtonOpcode; data: LONGINT): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7006, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceSetButtons*(ourDevice: CursorDevicePtr; numberOfButtons: INTEGER): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7007, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceSetAcceleration*(ourDevice: CursorDevicePtr; acceleration: Types.Fixed): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7008, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceDoubleTime*(ourDevice: CursorDevicePtr; durationTicks: LONGINT): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7009, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceUnitsPerInch*(ourDevice: CursorDevicePtr; resolution: Types.Fixed): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $700A, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceNextDevice*(VAR ourDevice: CursorDevicePtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $700B, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceNewDevice*(VAR ourDevice: CursorDevicePtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $700C, $AADB;
- (*$END*)
- PROCEDURE CursorDeviceDisposeDevice*(ourDevice: CursorDevicePtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $700D, $AADB;
- (*$END*)
-
- (* $ALIGN RESET*)
- (* $POP*)
-
- END CursorDevices.
-